package com.qf.blog.web.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.qf.blog.web.entity.InvitataionEntity;
import com.qf.blog.web.mapper.InvitataionMapper;
import com.qf.blog.web.service.IInvitataionService;
import com.qf.blog.web.vo.IndexDataVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

@Service
public class InvitataionServiceImpl extends ServiceImpl<InvitataionMapper, InvitataionEntity> implements IInvitataionService {

    @Autowired
    private InvitataionMapper invitataionDao;

    @Override
    public List<IndexDataVo> indexDataList(Integer order) throws Exception {
        return invitataionDao.indexDataList(order);
    }

    @Override
    public void indexDataPage(Page<IndexDataVo> page,Integer order) {
        invitataionDao.indexDataPage(page,order);
    }

    @Override
    public boolean save(InvitataionEntity invitataionEntity) {
        invitataionEntity.setStatus(1);
        invitataionEntity.setType(1);
        invitataionEntity.setCreateTime(new Date());
        invitataionEntity.setScore(0.1);
        invitataionEntity.setCommentCount(0);
        return super.save(invitataionEntity);
    }
}
